<%@ page contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>Title</title>
</head>
<body>
<article class="page-container">
    <form action="" method="get" class="form form-horizontal" id="form-admin-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">操作员编号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" style="background:#F5F5F5" class="input-text" readonly="readonly" value="${map.get("db1")[0].VALUE02}" id="VALUE02"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">操作员姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="readonly" value="${map.get("db1")[0].VALUE03}" id="VALUE03">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">原密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" value="" id="VALUE04">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">新密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" value="" id="VALUE05">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">确认密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" value="" id="VALUE06">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">

    $(document).ajaxComplete(function(event, xhr, settings) {
        //从http头信息取出 在filter定义的sessionstatus，判断是否是 timeout
        if(xhr.getResponseHeader("sessionstatus")==="timeout"){
            //从http头信息取出登录的url ＝ loginPath
            if(xhr.getResponseHeader("loginPath")){
                window.location.replace(xhr.getResponseHeader("loginPath"));
            }
        }
    });

    $(function()
    {
        var self = this;

        $("#form-admin-add").validate({
            rules:{
                value01:{
                    required:true
                },
                value02:{
                    required:true,
                    minlength:1,
                    maxlength:16
                },
                value03:{
                    required:true,
                    minlength:1,
                    maxlength:16
                },
                value04:{
                    required:true,
                    minlength:1,
                    maxlength:16
                },
                value05:{
                    required:true,
                    minlength:1,
                    maxlength:16
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                var LS_VALUE02  = $("#VALUE02").val()||'';
                var LS_VALUE04  = $("#VALUE04").val()||'';
                var LS_VALUE05  = $("#VALUE05").val()||'';
                var LS_VALUE06  = $("#VALUE06").val()||'';
                if (LS_VALUE05 !== LS_VALUE06)
                {
                    layer.msg('两次新密码不同',{icon:1,time:1000});
                    return;
                }
                //$(form).ajaxSubmit({              //该种方法提交是讲表单进行提交，后台将按照name的符号去获取值
                $.ajax({                            //该方法提交，在前端获取控件的值去进行提交， 两种方法就是前段和后端的区别
                    type: 'post',
                    url: "com",
                    data: {URL:'',
                        CMD:'ZJ',
                        VALUE01:LS_VALUE02,
                        VALUE02:LS_VALUE04,
                        VALUE03:LS_VALUE05
                        },
                    async:false,
                    success: function(data){
                        var jsonobj = JSON.parse(data);
                        var json1 = jsonobj.db1;
                        if (json1[0].VALUE01.toString() === 'ZZ00')
                        {
                            layer.msg('数据库操作完毕!', {icon: 1, time: 1500}, function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            });
                        }
                        else {
                            layer.msg(json1[0].VALUE02.toString(), {icon: 2, time: 1500, area: ['200px', '65px']});
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg('网络异常错误',{icon:1,time:1000});
                    }
                });
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
